package com.weimei.conversionTreasure.weight;

import android.annotation.SuppressLint;
import android.content.Context;
import android.widget.EditText;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.lxj.xpopup.core.CenterPopupView;
import com.weimei.conversionTreasure.R;

import me.goldze.mvvmhabit.utils.ToastUtils;


@SuppressLint("ViewConstructor")
public class LoginPop extends CenterPopupView {
    TextView tvSubmit;
    private OnSelCallBack mOnSelCallBack;
    private EditText edtAccount,edtPwd;

    public interface OnSelCallBack {
        void onCallBack(boolean s);
    }

    public LoginPop(@NonNull Context context, OnSelCallBack onSelCallBack) {
        super(context);
        this.mOnSelCallBack = onSelCallBack;
    }

    @Override
    protected void onCreate() {
        edtAccount = findViewById(R.id.edt_account);
        edtPwd = findViewById(R.id.edt_pwd);


        tvSubmit = findViewById(R.id.tv_submit);

        tvSubmit.setOnClickListener(v -> {
            if (edtAccount.getText().toString().equals("geetol") && edtPwd.getText().toString().equals("geetol")){
                mOnSelCallBack.onCallBack(true);
                dismiss();
            }else {
                ToastUtils.showShort("请输入账号和密码");
            }
        });



    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.popup_login;
    }

}
